package com.ksyun.campus.client.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

@JsonIgnoreProperties(ignoreUnknown = true)
public class AllocateBlocksResponse {
    @JsonProperty("ok")
    private Boolean ok;
    
    @JsonProperty("success")
    private Boolean success;
    
    private String message;
    private AllocateBlocksData data;
    private String code;
    private String leader;
    
    public static class AllocateBlocksData {
        private List<BlockInfo> blocks;
        
        public List<BlockInfo> getBlocks() {
            return blocks;
        }
        
        public void setBlocks(List<BlockInfo> blocks) {
            this.blocks = blocks;
        }
    }
    
    // BlockInfo 和 ReplicaInfo 现在使用独立的类
    // 请导入: import com.ksyun.campus.client.domain.BlockInfo;
    // 请导入: import com.ksyun.campus.client.domain.ReplicaInfo;
    
    public boolean isSuccess() {
        // 优先使用ok字段，如果不存在则使用success字段
        if (ok != null) {
            return ok;
        }
        if (success != null) {
            return success;
        }
        return false;
    }
    
    public Boolean getOk() {
        return ok;
    }
    
    public void setOk(Boolean ok) {
        this.ok = ok;
    }
    
    public Boolean getSuccess() {
        return success;
    }
    
    public void setSuccess(Boolean success) {
        this.success = success;
    }
    
    public String getMessage() {
        return message;
    }
    
    public void setMessage(String message) {
        this.message = message;
    }
    
    public AllocateBlocksData getData() {
        return data;
    }
    
    public void setData(AllocateBlocksData data) {
        this.data = data;
    }
    
    public String getCode() {
        return code;
    }
    
    public void setCode(String code) {
        this.code = code;
    }
    
    public String getLeader() {
        return leader;
    }
    
    public void setLeader(String leader) {
        this.leader = leader;
    }
}